package config

import (
	"github.com/joho/godotenv"
	"os"
)

var (
	App app
	Database database
	Redis redis
	Data data
)

// LoadConfig 加载配置
func LoadConfig() {
	_ = godotenv.Load()

	App = app{
		UploadPath: os.Getenv("APP_UPLOAD_PATH"),
	}

	Database = database{
		Host: os.Getenv("DB_HOST"),
		Port: os.Getenv("DB_PORT"),
		Database: os.Getenv("DB_DATABASE"),
		Username: os.Getenv("DB_USERNAME"),
		Password: os.Getenv("DB_PASSWORD"),
	}

	Redis = redis{
		Host: os.Getenv("REDIS_HOST"),
		Port: os.Getenv("REDIS_PORT"),
		Password: os.Getenv("REDIS_PASSWORD"),
	}

	initData()
}
